{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f6ab422b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import xlwings as xw\n",
    "\n",
    "\"\"\"\n",
    "打开工作簿\n",
    "\"\"\"\n",
    "\n",
    "app = xw.App(visible = False, add_book = False)\n",
    "\n",
    "workbook = app.books.open('foo.xlsx')\n",
    "\n",
    "#创建表格\n",
    "workbook.sheets.add('新表')\n",
    "\n",
    "#遍历表格\n",
    "for sheet in workbook.sheets:\n",
    "    print(sheet)\n",
    "    \n",
    "workbook.sheets['新表'].range('A1').value = '编号'\n",
    "\n",
    "workbook.save()\n",
    "app.quit()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
